package com.qf.java2107.yb.hotel.listeners;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * 地址URL封装
 * @author yb
 * @version 1.0
 * @date 2021-10-25
 **/
@WebListener
public class StaticResourceFolderListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent event) {
        ServletContext context = event.getServletContext();

        //   /项目路径/backend/detail/style
        context.setAttribute("backendFolder", context.getContextPath() + "/backend/detail/style");

        context.setAttribute("backendDetailFolder", context.getContextPath() + "/backend/detail");

        context.setAttribute("ctx", context.getContextPath());

        context.setAttribute("frontFolder", context.getContextPath() + "/front/detail/style");

        context.setAttribute("frontDetailFolder", context.getContextPath() + "/front/detail");

    }

    @Override
    public void contextDestroyed(ServletContextEvent event) {

    }
}
